package com.yida.gwj.expend.enums;

import cn.hutool.core.util.ObjectUtil;

/**
 * 业务状态
 *
 * @author liangp
 */
public enum BusinessStatusEnum {
    /**
     * 业务状态  1:保存 2:提交 3:取件 4:退件 5:审核通过 6:回退 7:初审提交 8:复审提交 9:财务对账 10:办结
     */
    NULL(0, "不校验"),
    SAVE(1, "保存"),
    SUBMIT(2, "提交"),
    TAKE_PARTS(3, "取件"),
    RETREAT_PARTS(4, "退件"),
    APPROVED(5, "审核通过"),
    FALLBACK(6, "回退"),
    FIRST_INSTANCE(7, "初审"),
    REEXAMINE(8, "复审"),
    FINANCE_CHECK(9, "财务对账"),
    FINISH(10, "办结"),
    ;
    /**
     * 错误码
     */
    private final Integer code;

    /**
     * 描述
     */
    private final String msg;

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    BusinessStatusEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    /**
     * @return
     */
    public static BusinessStatusEnum transfer(Integer code) {
        for (BusinessStatusEnum value : BusinessStatusEnum.values()) {
            if (ObjectUtil.equals(value.getCode(), code)) {
                return value;
            }
        }
        return null;
    }
}
